package com.oss.job;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.quartz.JobExecutionContext;

/**
 * 每秒钟执行
 *
 * @author Jieven
 * @date 2014-7-7
 */
public class EverySecondJob extends AbsJob {

	@Override
	protected void process(JobExecutionContext context) {
		String classess = getClass().getResource("/").getPath();
		String project;
		if(classess.indexOf("xsd")>=0){
			project = classess.substring(classess.startsWith("/usr")?0:1,classess.indexOf("xsd")+3);
		}
		else{
			project = classess.substring(classess.startsWith("/usr")?0:1,classess.indexOf("ROOT")+4);
		}
		String ue = project+"/ueditor/upload/image/";
		File resFile = new File(ue);  
        File distFile = new File("/home/static/temp/ueditor/upload");  
        try {
			FileUtils.copyDirectoryToDirectory(resFile, distFile);
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println(project);
	}
}
